let Web3 = require('web3');
let contract = require('truffle-contract');

//导入合约的ABI文件
let artifacts = require('../../build/contracts/patient.json');


let patient = contract(artifacts);

let provider = new Web3.providers.HttpProvider("http://localhost:7545");
patient.setProvider(provider);

patient.defaults({
    from: "0x9Fe10333736242829f7664658E588C694b107CAA",
    gas: 4712388, gasPrice: 100000000000
});
patient.currentProvider.sendAsync = function () {
    return patient.currentProvider.send.apply(patient.currentProvider, arguments);
};

let contract_address = "0xbcf004c560fb626c97a25b6fa19c7b90f99fbb67";
let patientfun = patient.at(contract_address);

exports=patientfun;


patientfun.then(function (contractInstance) {
    return contractInstance.init_patient_information("1", "2", "3", "4", "5", "6", "7", "8")
}).then(function (result) {
    console.log(result);
});

//
// patientfun.then(function (contractInstance) {
//     return contractInstance.init_patient_information("1", "2", "3", "4", "5", "6", "7", "8")
// }).then(function (result) {
//     console.log(result);
// });
//

// patientfun.then(function (contractInstance) {
//     return contractInstance.show_patient_address.call();
// }).then(function (result) {
//     console.log(result);
// });
